#include "lib.h"

#include "font.h"
#include "fontclass.h"
using namespace Library;

//----------------------------------------------------------------------------
// Public
//

/**
 * Creates a font class with no functionality.
 */
Font::Font()
{
}

/**
 * The destructor.
 */
Font::~Font()
{
}

/**
 * @return		The ascent of the font - measured in pixels.
 *
 * This method returns the ascent of the font.  The ascent, measured in pixels,
 * is the distance from the base line to the top of the font.
 */
int32
Font::ascent()
{
	return 0;
}

/**
 * @param ch	The character to be queried.
 *
 * @return		An index into the font metric for the specified character.  If
 *				the character does not exist in the font, NOCHAR is returned.
 *
 * This method maps an ASCII character into the font's character set.  The
 * value returned is typically the character's position in the font metric.
 */
int32
Font::charOffset(const uint16 ch)
{
	NOTUSED(ch);
	return NOCHAR;
}

/**
 * @return		The descent of the font - measured in pixels.
 *
 * This method returns the descent of the font.  The descent, measured in
 * pixels, is the distance from the base line to the bottom of the font.
 */
int32
Font::descent()
{
	return 0;
}

/**
 * @param x		An integer pointer specifying the x-coordinate location of
 *              the draw.
 * @param y		An integer specifying the y-coordinate location of the draw.
 * @param ch	The character to draw.
 * @param dst	A pointer to a bitmap.
 *
 * @return		The x-coordinate location is updated with the next paint
 *				location as determined by the font metrics for the character.
 *
 * This method draws the specified character ch to location x, y in the bitmap.
 * The actual x-coordinate is based on the value passed in and the A font
 * metric for the particular character.
 *
 * The x-coordinate is updated as a convenience to the calling method.  This
 * value should be used in the next call to drawText if properly spaced text,
 * as defined by the font, is desired.
 *
 * Characters which do not exist in the font are replaced by spaces.
 */
void
Font::drawText(int32 * x, int32 y, const uint16 ch, pCFrame frame)
{
	NOTUSED4(x, y, ch, frame);
}

/**
 * @param x		An integer pointer specifying the x-coordinate location of
 *              the draw.
 * @param y		An integer specifying the y-coordinate location of the draw.
 * @param text	The text to draw.
 * @param dst	A pointer to a bitmap.
 *
 * @return		The x-coordinate location is updated with the next paint
 *				location as determined by the font metrics for the text.
 *
 * This method draws the specified character string text to location x, y in
 * the bitmap. The actual x-coordinate is based on the value passed in and
 * the A font metric for the first character of the string.
 *
 * The x-coordinate is updated as a convenience to the calling method.  This
 * value should be used in the next call to drawText if properly spaced text,
 * as defined by the font, is desired.
 *
 * Characters which do not exist in the font are replaced by spaces.
 */
void
Font::drawText(int32 * x, int32 y, const uint16* text, uint32 len, pCFrame frame)
{
	NOTUSED5(x, y, text, len, frame);
}

/**
 * @param x		An integer pointer specifying the x-coordinate location of
 *              the draw.
 * @param y		An integer specifying the y-coordinate location of the draw.
 * @param ch	The character to draw.
 * @param dst	A pointer to a bitmap.
 *
 * @return		The x-coordinate location is updated with the next paint
 *				location as determined by the font metrics for the character.
 *
 * This method draws the specified character ch to location x, y in the bitmap.
 * The actual x-coordinate is based on the value passed in and the A font
 * metric for the particular character.
 *
 * The x-coordinate is updated as a convenience to the calling method.  This
 * value should be used in the next call to drawText if properly spaced text,
 * as defined by the font, is desired.
 *
 * Characters which do not exist in the font are replaced by spaces.
 */
void
Font::drawText(int32 * x, int32 y, const uint16 ch, pCBitmap bitmap)
{
	NOTUSED4(x, y, ch, bitmap);
}

/**
 * @param x		An integer pointer specifying the x-coordinate location of
 *              the draw.
 * @param y		An integer specifying the y-coordinate location of the draw.
 * @param text	The text to draw.
 * @param dst	A pointer to a bitmap.
 *
 * @return		The x-coordinate location is updated with the next paint
 *				location as determined by the font metrics for the text.
 *
 * This method draws the specified character string text to location x, y in
 * the bitmap. The actual x-coordinate is based on the value passed in and
 * the A font metric for the first character of the string.
 *
 * The x-coordinate is updated as a convenience to the calling method.  This
 * value should be used in the next call to drawText if properly spaced text,
 * as defined by the font, is desired.
 *
 * Characters which do not exist in the font are replaced by spaces.
 */
void
Font::drawText(int32 * x, int32 y, const uint16* text, uint32 len, pCBitmap bitmap)
{
	NOTUSED5(x, y, text, len, bitmap);
}

/**
 * @return		The external leading space of the font - measured in pixels.
 *
 * This method returns the external leading space of the font.  The external
 * leading space, measured in pixels, is the distance between two lines of
 * font.  That is, it's the distance from the bottom of one font to the top
 * of the font on the next line.
 */
int32
Font::externalLeading()
{
	return 0;
}

/**
 * @param width		An integer pointer that accepts the glyph metric width.
 * @param height	An integer pointer that accepts the glyph metric height.
 * @param left		An integer pointer that accepts the glyph metric left.
 * @param right		An integer pointer that accepts the glyph metric right.
 * @param top		An integer pointer that accepts the glyph metric top.
 * @param bottom	An integer pointer that accepts the glyph metric bottom.
 * @param ch		The character to be queried.
 *
 * This method returns the glyph metrics of the specified character @p ch.
 *
 * @image html font.png
 *
 * Glyph metric definitions:
 *		@li @p width is the width of the glyph - not the font.
 *		@li @p height is the height of the glyph - not the font.
 *		@li @p left is the distance from the left edge of the glyph to font's
 *			text metric A.
 *		@li	@p right is the distance from the right edge of the glyph to the
 *			font's text metric C.
 *		@li @p top is the distance from the top edge of the glyph to the top
 *			edge of the font.
 *		@li @p bottom is the distance from the bottom edge of the glyph to
 *			the bottom edge of the font.
 *
 *
 * If the character does not exist in the font, all glyph metric values will
 * be set to zero.
 */
void
Font::glyphMetric(int32 * width, int32 * height, int32 * left, int32 * right,
	int32 * top, int32 * bottom, const uint16 ch)
{
	if (width)	*width  = 0;
	if (height)	*height = 0;
	if (left)	*left	= 0;
	if (right)	*right	= 0;
	if (top)	*top	= 0;
	if (bottom)	*bottom = 0;
}

/**
 * @param width		An integer pointer that accepts the glyph metric width.
 * @param height	An integer pointer that accepts the glyph metric height.
 * @param left		An integer pointer that accepts the glyph metric left.
 * @param right		An integer pointer that accepts the glyph metric right.
 * @param top		An integer pointer that accepts the glyph metric top.
 * @param bottom	An integer pointer that accepts the glyph metric bottom.
 * @param text		The text string to be queried.
 *
 * This method returns the glyph metrics of the specified text string @p text.
 *
 * @image html font.png
 *
 * Glyph metric definitions:
 *		@li @p width is the width of the string.
 *		@li @p height is the height of the string.
 *		@li @p left is the distance from the left edge to text metric A of
 *			the string's first glyph.
 *		@li @p right is the distance from the right edge to text metric C of
 *			the string's last glyph.
 *		@li @p top is the distance from the highest glyph's top edge to the
 *			top of the font.
 *		@li @p bottom is the distance from the lowest glyph's bottom edge to
 *			the bottom of the font.
 *
 *
 * If a character does not exist within the font, the space glyph (" ") and
 * its glyph metrics will be used.
 */
void
Font::glyphMetric(int32 * width, int32 * height, int32 * left, int32 * right,
	int32 * top, int32 * bottom, const uint16* text, uint32 len)
{
	NOTUSED(len);

	if (width)	*width  = 0;
	if (height)	*height = 0;
	if (left)	*left	= 0;
	if (right)	*right	= 0;
	if (top)	*top	= 0;
	if (bottom)	*bottom = 0;
}

/**
 * @param kind		FontClass identifier to test.
 *
 * @return			@li @c true if the font is @p kind.
 *					@li @c false if it is not.
 *
 * This is a runtime support method used to determine if a font isA @p kind.
 */
bool8
Font::isA(uint32 kind)
{
	return false;
}

/**
 * @return			Returns a FontClass identifier.
 *
 * This method returns a FontClass identifier that specifies the kind of font.
 */
uint32
Font::kind()
{
	return (uint32)FONTCLASS_UNKNOWN;
}

/**
 * @return		The height of the tallest glyph.
 *
 * This method returns the height of the tallest glyph in the font.
 */
int32
Font::maximumGlyphHeight()
{
	return 0;
}

/**
 * @return		The width of the widest glyph.
 *
 * This method returns the width of the widest glyph in the font.
 */
int32
Font::maximumGlyphWidth()
{
	return 0;
}

/**
 * @return		The height of the font.
 *
 * This method returns the height of the font.
 */
int32
Font::maximumTextHeight()
{
	return 0;
}

/**
 * @return		The width of the font.
 *
 * This method returns the width of the font.
 */
int32
Font::maximumTextWidth()
{
	return 0;
}

/**
 * @param width		An integer pointer that accepts the text metric width.
 * @param height	An integer pointer that accepts the text metric height.
 * @param abcA		An integer pointer that accepts the text metric abcA.
 * @param abcC		An integer pointer that accepts the text metric abcC.
 * @param ch		The character to be queried.
 *
 * Text metric definitions:
 *		@li @p width is the width of the character; defined as the sum of
 *			abcA, abcB, and abcC.  This is not the width of the glyph.
 *		@li @p height is the height of the character; defined as the sum of
 *			the ascent and descent.
 *		@li @p abcA is the A component of the ABC metric of character @p ch.
 *		@li @p abcC is the C component of the ABC metric of character @p ch.
 */
void
Font::textMetric(int32 * width, int32 * height, int32 * abcA, int32 * abcC,
	const uint16 ch)
{
	if (width)	*width  = 0;
	if (height)	*height = 0;
	if (abcA)	*abcA	= 0;
	if (abcC)	*abcC	= 0;
}

/**
 * @param width		An integer pointer that accepts the text metric width.
 * @param height	An integer pointer that accepts the text metric height.
 * @param abcA		An integer pointer that accepts the text metric abcA.
 * @param abcC		An integer pointer that accepts the text metric abcC.
 * @param text		The string to be queried.
 *
 * Text metric definitions:
 *		@li @p width is the width of the string.
 *		@li @p height is the height of the string.
 *		@li @p abcA is the A component of the ABC metric of the first
 *			character in the string.
 *		@li @p abcC is the C component of the ABC metric of the last
 *			character in the string.
 */
void
Font::textMetric(int32 * width, int32 * height, int32 * abcA, int32 * abcC,
	const uint16* text, uint32 len)
{
	NOTUSED(len);

	if (width)	*width  = 0;
	if (height)	*height = 0;
	if (abcA)	*abcA	= 0;
	if (abcC)	*abcC	= 0;
}

bool8
Font::isLoaded()
{
	return true;
}